<template>
  <div>
    <router-link
      :to="{name: 'rindex_rhome'}"
      class="rlink"
      @click.native="tabck(1)"
    >首页</router-link>
    <router-link
      :to="{name: 'rindex_rnews'}"
      class="rlink"
      @click.native="tabck(2)"
    >新闻</router-link>
    <router-link
      :to="{name: 'rindex_ryl'}"
      class="rlink"
      @click.native="tabck(3)"
    >娱乐</router-link>
    <!-- 二级子路由页面 -->
    <router-view />
  </div>
</template>
<script>
export default {
  data () {
    return {
      selected: 1
    }
  },
  methods: {
    tabck (index) {
      this.selected = index // 设置tab选中项
    }
  }
}
</script>
<style>
.rlink {
  padding: 5px;
  margin: 5px;
  margin-bottom: 10px;
  display: inline-block;
  text-decoration: none;
  color: blue;
}

.rlink.active {
  color: red;
  text-decoration: underline;
}
</style>
